LIBRARY_PATH := inc/
SQL_PATH	 := sqlite3_ku/include/

cc=	gcc
AR= ar

./PHONY: all socket_serv_lib

all: socket_serv_lib
	${CC} src/server_epoll.c -I$(LIBRARY_PATH) -I$(SQL_PATH) -Lsrc/ -Lsqlite3_ku/lib -lsocket_server -lsqlite3 -llogger -ldatabase -o src/server_epoll
	@make clean_a_o

socket_serv_lib:
	${CC} -shared -fPIC -o src/liblogger.so src/logger.c -I$(LIBRARY_PATH)
	${CC} -shared -fPIC -o src/libsocket_server.so src/socket_server.c -I$(LIBRARY_PATH) -I$(SQL_PATH) -Lsrc/ -llogger
	${CC} -shared -fPIC -o src/libdatabase.so src/database.c -I$(LIBRARY_PATH) -I$(SQL_PATH) -Lsrc -Lsqlite3_ku/lib -lsqlite3 -llogger
clean_a_o:
	@rm -f src/*.so src/*.o

clean:
	@rm -f src/server_epoll
